Zepir – Zero Components Computer

A computer you can actually understand: a Raspberry Pi Zero 2 W wired straight to a screen, a keyboard and a speaker. No hidden chips. My computer, my rules.

Work in progress: details may differ slightly between board revisions

0The big picture

The board is mostly copper traces. The Pi does the thinking and Linux drivers do the rest.

Power moduleseparate, with power button
→
Pi Zero 2 W40‑pin header
⇄
DisplaySPI
Keyboard7 × 10 matrix
Speaker1‑bit PWM
USB‑Awired to Pi test pads
For everyone

Zepir has no keyboard chip, no screen‑driver chip and no sound card. Your Pi talks to the screen, the keys and the speaker directly through its own pins. That only works once the Pi has been told how, which is why the software setup below matters so much.

For programmers

Three stock kernel drivers, configured by device‑tree overlays: panel-mipi-dbi (DRM display), gpio-matrix-keypad (input) and PWM audio. No custom kernel modules, no userspace polling.

1Software first

Until these are set up, the screen stays black, the keys do nothing and there is no sound.

What needs configuring

PartWhat sets it upIf it is missing
Displayconfig.txt display lines and the init file zepir-st7789.bin in /lib/firmwareBlack screen
KeyboardAn overlay (.dtbo) in overlays/ plus one dtoverlay= lineKeys do nothing
Sounddtoverlay=pwm, snd_bcm2835.enable_headphones=1 in cmdline.txt, output set to headphonesNo sound card
Consolefbcon=map:10 in cmdline.txt, small fontText not shown on the little screen
Important
Copy the setup files BEFORE the first power‑on. Right after the SD card has been written with the Raspberry Pi OS image, copy the files in. The first‑boot script (cloud‑init) runs only once, so if the Pi boots even once without them, the scripts are never activated. You would have to reflash the card or use the manual route below.
Automatic route
  1. Write Raspberry Pi OS (64‑bit) to the SD card with Raspberry Pi Imager. Do not eject it yet.
  2. Open the small boot drive (bootfs). Copy in config.txt, cmdline.txt, user-data and network-config, overwriting the existing ones.
  3. Copy the .dtbo files into the overlays folder, and the zepir folder with zepir-st7789.bin next to the other files.
  4. Enter your Wi‑Fi name and password in network-config, and change the default password in user-data.
  5. Choose your keyboard overlay (see below), insert the card and power on. The Pi configures itself, reboots once and shows the console on the display.
What first boot does
Loginhost zepir, user pi, SSH on
NetworkWi‑Fi from network-config
RegionEurope/Bratislava, US keyboard
Consoleautologin, no desktop
Soundoutput set to the headphone jack
FontTerminus 6x12 for the small screen
Displayinit file copied to /lib/firmware
Finishone automatic reboot
Manual route

Missed the window? Connect over SSH, for example ssh pi@zepir.local, and run:

sudo raspi-config

Expand the filesystem, enable console autologin (boot to terminal, CLI), set the audio output to the headphone jack, then Finish. Menu wording differs a little between versions. Then set the console font:

sudo dpkg-reconfigure console-setup
Pick one keyboard

Enable exactly one overlay in config.txt and comment out the other:

dtoverlay=zepir-keyboard-classic
#dtoverlay=zepir-keyboard-flip

Classic is the layout shown in section 3. FLIP has its own overlay and its own infographic.

The key lines in config.txt
dtparam=spi=on
dtparam=uart0=off
enable_uart=0
dtoverlay=mipi-dbi-spi,spi0-0,speed=96000000,cpol,cpha,write-only
dtparam=compatible=zepir-st7789\0panel-mipi-dbi-spi
dtparam=width=320,height=240,width-mm=57,height-mm=43
dtparam=dc-gpio=25
dtparam=reset-gpio=15
dtparam=backlight-gpio=14
dtoverlay=pwm
dtoverlay=zepir-keyboard-classic

The serial port is switched off on purpose: its pins (TXD, RXD) are reused for display reset and backlight.

Display driver details

The kernel’s panel-mipi-dbi driver gives a real DRM/KMS device (/dev/dri/card0, 320×240) plus a framebuffer for the console. Only the panel’s init sequence is custom, loaded as a firmware file.

Init commands go out at 10 MHz and pixels at 96 MHz, so a fast clock cannot corrupt the setup. Orientation is MADCTL 0x68. The binary starts with the header MIPI DBI and a version byte.

Text is zepir-st7789.txt; the tool mipi-dbi-cmd from notro/panel-mipi-dbi compiles it to .bin. LVGL (DRM), SDL2 kmsdrm and Wayland can use the panel.

Keyboard driver details

gpio-matrix-keypad sleeps on GPIO interrupts and scans only when a key goes down. It debounces, repeats keys and appears as a normal keyboard (/dev/input/event0, zepir_keyboard). Idle CPU is about 0.4 %, versus 17.7 % for the old Python poller.

Build an overlay from source:

dtc -@ -I dts -O dtb -o /boot/firmware/overlays/zepir-keyboard-classic.dtbo zepir-keyboard-classic.dts
Tuning options
dtoverlay=zepir-keyboard-classic,debounce=20
dtoverlay=zepir-keyboard-classic,norepeat

Use debounce if a key double‑types (default 10 ms). Remap single keys without rebuilding using setkeycodes or a udev hwdb entry.

Sound pitfalls

Do not use audremap: it takes GPIO12 and 13, which are keyboard lines, and the keyboard driver then fails with “pin already requested”.

The speaker sits on GPIO18 via dtoverlay=pwm. Because the Zero 2 W has no jack, snd_bcm2835.enable_headphones=1 in cmdline.txt is needed for the sound card to appear.

Check that it works
Screenls /dev/dri shows card0
Keyboardevtest lists zepir_keyboard and shows key presses
Soundaplay -l lists a headphones device
Consolecat /sys/class/graphics/fb*/name shows which framebuffer is the panel

2Display wiring

Two interchangeable modules share the same signals. Use whichever you have.

A · Generic 8‑pin module

common Chinese TFT
PinSignalGoes to
1GNDGND
23.3 V3.3 V
3SCKPi pin 23
4DATAPi pin 19
5RESETAXP803 or RXD
6DCPi pin 22
7CSPi pin 24
83.3 V (backlight)3.3 V

B · ST7789 module

flex (FPC) cable
PinSignalGoes to
1GNDGND
2RESETAXP803 or RXD
3SCLPi pin 23
4D/CXPi pin 22
5CSXPi pin 24
6SDIPi pin 19
7SDOnot used
8GNDGND
9–10VCC, LEDA3.3 V
11–14LED_K1–410 Ω each → backlight switch
15–18touchnot used
What is a solder jumper?

Two bare copper pads. Touch them with a blob of solder and they become a wire; remove the solder and the wire is gone. They are switches you set once. On the PCB they carry no numbers, only a short text note beside each.

Reset: two ways

AXP803power‑up reset
→
Display RESET10 kΩ pull‑up
←
RXD pinreset jumper

By default the AXP803 resets the screen at power‑up. Close the reset jumper and the Pi can reset it instead through GPIO15 (reset-gpio=15).

Backlight: three choices

TXD pinGPIO14
→
TXD jumper
→
Transistor
→
Backlight

Software control: close the TXD jumper. High is on, low is off (backlight-gpio=14), so Linux can switch it for screen sleep.

Always on: close the “always on” jumper instead.

Generic 8‑pin module: its backlight is simply tied to 3.3 V.

Screen sleep for programmers

Write 28 then 10 (Display Off, Sleep In) to /sys/kernel/debug/dri/spi0.0/command, and 11 then 29 to wake. Combined with the backlight pin, the panel goes fully dark.

3Keyboard

70 keys, scanned as a matrix: 7 column lines × 10 row lines. The left half is rows 1–5, the right half rows 6–10.

COL = column wireROW = row wireGreen keys are modifiers and action keys
No diodes are used, so pressing 3 or more keys at once can produce “ghost” keys. That is fine for typing.
17 wires for 70 keys

Picture a grid of streets: 10 east–west row wires and 7 north–south column wires. Each key is a small bridge between one row and one column. The Pi switches the rows on one at a time and listens on the columns. If a column answers, the key at that crossing is pressed.

Wiring as the kernel sees it
Our nameGPIOKernel name
ROW1–1024 16 5 19 12 20 6 26 13 21col-gpios, driven low
COL1–72 3 4 17 27 23 22row-gpios, pull‑ups

The names are swapped on purpose: the kernel’s “row” is our column. Key at row j, column i sits at index i·7+j in the table.

4Pinout

Raspberry Pi 40‑pin header as used by Zepir, seen from above, pin 1 at top left.

■ power■ GND■ columns■ display■ rows, audio, reset, backlight

5Sound, USB and power

Three small, separate pieces.

Speaker: 1‑bit PWM

GPIO18 Q1 BSS84P‑ch, to 3.3 V Q4 N‑chto GND 100µF OUT_L

Both transistors share one signal, so the output flips between 3.3 V and GND with the PWM audio. The capacitor blocks DC and passes only the sound to the speaker.

USB‑A

The Pi Zero has no USB socket, so the USB‑A port is wired by short wires to the D+ and D− test points on the underside of the Pi.

Power

A separate power module with an on/off button supplies 5 V to header pins 2 and 4.

There is no serial console: the TXD and RXD pins are used by the display backlight and reset. Use SSH for debugging.